package com.union.official.common.exception;

import lombok.Data;

/**
 * @author jimmy
 * @description 业务异常的封装
 * @date 2024-01-04 21:30:02
 */
@Data
public class ServiceException extends RuntimeException {

    private Integer code;
    private String message;

    /**
     * <p>
     * Description: 构造函数
     * </p>
     *
     * @param cause 堆栈
     */
    public ServiceException(Throwable cause) {
        super(cause);
    }

    public ServiceException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public ServiceException(AbstractServiceException exception) {
        super(exception.getMessage());
        this.code = exception.getCode();
        this.message = exception.getMessage();
    }

    public ServiceException(AbstractServiceException exception,String message) {
        super(exception.getMessage());
        this.code = exception.getCode();
        this.message = message;
    }
}
